<!doctype html>
<html>
<head>
<meta charset="utf-8">

</head>
<body>

<div id="div1">div元素</div>

<script>
var div = document.getElementById("div1");
var text = div.innerText;
alert(text);

text = div.firstChild.nodeValue;
alert(text);
</script>



</body>
</html>
